<?php

namespace App\Models;

use Illuminate\Support\Str;
use Storage;

class Article extends Model
{
    protected $guarded = [];

    /*
     * 关联模型
     */
    public function cate()
    {
        return $this->belongsTo(ArticleCate::class, 'article_cate_id');
    }

    public function replies()
    {
        return $this->hasMany(ArticleReply::class);
    }


    /**
     * 访问器
     */
    public function getLogoUrlAttribute()
    {
        return Storage::disk(config('admin.upload.disk'))->url($this->logo);
    }
}
